#ifndef __SQL_FUNC_H__
#define __SQL_FUNC_H__

/*
    ID definition for inline function
    S_FUNC_XXXX

    S_FUNC_TYPE_DEF
    S_FUNC_TYPE_COUNT
*/
typedef 
enum
{
  S_FUNC_NONE_       =0,
  S_FUNC_ABS          ,
  S_FUNC_CEIL         ,
  S_FUNC_CHAR_LENGTH  ,
  S_FUNC_CHR          ,
  S_FUNC_DECODE       ,
  S_FUNC_DECR         ,
  S_FUNC_DRAND        ,
  S_FUNC_DRANDOM      ,
  S_FUNC_EXP          ,
  S_FUNC_FLOOR        ,
  S_FUNC_GREATEST     ,
  S_FUNC_GROUPBY_NUM  ,
  S_FUNC_INCR         ,
  S_FUNC_INST_NUM     ,
  S_FUNC_INSTR        ,
  S_FUNC_LAST_DAY     ,
  S_FUNC_LEAST        ,
  S_FUNC_LOG          ,
  S_FUNC_LPAD         ,
  S_FUNC_LTRIM        ,
  S_FUNC_MODULUS      ,
  S_FUNC_MONTHS_BETWEEN,
  S_FUNC_NVL          ,
  S_FUNC_NVL2         ,
  S_FUNC_ORDERBY_NUM  ,
  S_FUNC_POWER        ,
  S_FUNC_RAND         ,
  S_FUNC_RANDOM       ,
  S_FUNC_ROUND        ,
  S_FUNC_RPAD         ,
  S_FUNC_RTRIM        ,
  S_FUNC_SIGN         ,
  S_FUNC_SQRT         ,
  S_FUNC_SUBSTRING    ,
  S_FUNC_TO_CHAR      ,
  S_FUNC_TO_DATE      ,
  S_FUNC_TO_DATETIME  ,
  S_FUNC_TO_NUMBER    ,
  S_FUNC_TO_TIME      ,
  S_FUNC_TO_TIMESTAMP ,
  S_FUNC_TRUNC        ,

  S_FUNC_PLUS          ,
  S_FUNC_MINUS        ,
  S_FUNC_STRCAT     ,
  S_FUNC_TIMES,
  S_FUNC_POSITION,
  S_FUNC_DIVIDE,
  S_FUNC_TRIM,
  S_FUNC_OCTET_LENGTH,
  S_FUNC_LOWER,
  S_FUNC_UPPER,
  S_FUNC_AVG,
  S_FUNC_MIN,
  S_FUNC_MAX,
  S_FUNC_SUM,

  S_FUNC_UNARY_MINUS,
  S_FUNC_BIT_LENGTH,
  S_FUNC_TRANSLATE,
  S_FUNC_STDDEV,
  S_FUNC_NULLIF,
  S_FUNC_EXTRACT,
  S_FUNC_YEAR,
  S_FUNC_MONTH,
  S_FUNC_DAY,
  S_FUNC_HOUR,
  S_FUNC_MINUTE,
  S_FUNC_SECOND,
  S_FUNC_OR,
  S_FUNC_AND,
  S_FUNC_NOT,
  S_FUNC_EXISTS,
  S_FUNC_EQ,
  S_FUNC_EQ_ALL,
  S_FUNC_EQ_SOME,
  S_FUNC_NE,
  S_FUNC_NE_ALL,
  S_FUNC_NE_SOME,
  S_FUNC_GT,
  S_FUNC_GT_ALL,
  S_FUNC_GT_SOME,
  S_FUNC_GE,
  S_FUNC_GE_ALL,
  S_FUNC_GE_SOME,
  S_FUNC_LT,
  S_FUNC_LT_ALL,
  S_FUNC_LT_SOME,
  S_FUNC_LE,
  S_FUNC_LE_ALL,
  S_FUNC_LE_SOME,
  S_FUNC_NOT_LIKE,
  S_FUNC_LIKE,
  S_FUNC_IS_NOT_NULL,
  S_FUNC_IS_NULL,
  S_FUNC_NOT_BETWEEN,
  S_FUNC_BETWEEN,
  S_FUNC_IS_IN,
  S_FUNC_IS_NOT_IN,
  S_FUNC_PRIOR,

  S_FUNC_TYPE_COUNT   ,
}S_FUNC_TYPE_DEF;

struct SQL_node_func_t
{
  const char* name;
  int (*func)();
};

extern struct SQL_node_func_t SQL_func_map[S_FUNC_TYPE_COUNT];

struct SQL_node_func_t * sql_get_function_by_name ( const char* name);

#endif